<template>
<div id="queryTemplate">
	<el-row>
		<el-col :span="24">
			<!-- <el-form :model="queryform"> -->
			<el-form :model="queryform" :status-icon="true" :show-message="false" :inline="true" ref="queryform" label-width="100px" class="demo-ruleForm">
				
				<el-row>
					<el-col :span="11" >
						<el-form-item label="分队编码" prop="subUnit">	
							<el-input v-model="queryform.subUnit" ></el-input>
						</el-form-item>
					</el-col>

					<el-col :span="11">
						<el-form-item label="费用类型" prop="costType">
							<drop-select dataKey="payment_fylx" :dataValue.sync="queryform.costType"></drop-select>
						</el-form-item>
					</el-col>
					
				</el-row>

				<el-row>
					<el-col :span="11" >
						<el-form-item label="渠道类型" prop="mchType">
							<drop-select dataKey="payment_qdlx" :dataValue.sync="queryform.mchType"></drop-select>
						</el-form-item>
					</el-col>

					<el-col :span="11">
						<el-form-item label="商户主键" prop="mchId">
							<div  class="el-input el-input--small el-input-group el-input-group--append">
								<input v-model="queryform.mchId" autocomplete="off" placeholder="请输入内容" size="small" type="text" rows="2" validateevent="true" class="el-input__inner">
								<div class="el-input-group__append"  @click="innerDialogFormVisible = true" >
								<i  class="el-icon-search"></i>
								</div>
							</div>
						</el-form-item>
					</el-col>
				</el-row>

				<el-row>
					<el-col :span="11" >
						<el-form-item label="商户代码" prop="mchCode">
							<el-input v-model="queryform.mchCode" ></el-input>
						</el-form-item>
					</el-col>

					<el-col :span="11" >
						<el-form-item label="规则状态" prop="ruleStatus">
							<drop-select dataKey="syzt" :dataValue.sync="queryform.ruleStatus"></drop-select>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>

		</el-col>
	</el-row>

	<!--查询提示弹出窗--> 
	<div class="query-pop-up">
		<el-dialog title="请输入要查询的字段" :append-to-body='true'  :visible.sync="innerDialogFormVisible" width="40%" @close="$emit('update:show', false)"  >
		
			<!-- 高级查询模板组件 -->
			<rulesMerchantFilesTable @query-data="getQueryData" @refresh-quey-data="refreshQueyData" :innerSubmitSearch.sync="innerSubmitSearch"></rulesMerchantFilesTable>

			<div slot="footer" class="dialog-footer">
				<el-button @click="innerDialogFormVisible = false" size="small">取 消</el-button>
				<el-button type="primary" @click="innerSubmitSearchBtn('true')" size="small">确定</el-button>
			</div>
    	</el-dialog>
  	</div>

</div>


</template>

<script>
import treeSelect from "@/components/tree/treeSelect";
import gridSelect from "@/components/grid/gridSelect";
import dropSelect from "@/components/select/dropSelect";

import { mergeQuery,appendQueryParams,getDictLableName } from "@/utils/dataUtils";
import rulesMerchantFilesTable from "./rulesMerchantFilesTable";

export default {
  name:'paymentRules_queryTemplate',
  components: {
	 treeSelect,
     gridSelect,
	 dropSelect,
	 rulesMerchantFilesTable
  },
  data() {
    return {
	  innerSubmitSearch:undefined,//true 提交搜索，false 清空搜索条件
	  innerDialogFormVisible: false,
	  queryform:{subUnit:undefined,costType:undefined,mchType:undefined,mchId:undefined,mchCode:undefined,ruleStatus:undefined},
	  tableParams:{
          parentId: "1",
          pageNo : "1",
          pageSize : "10",
          reqCode : "1",
          orderBy : "",
          searchValue:""
	  },
	  
	  isShow : true,
	  loading:false,  //加载遮罩层显示
    };
  },
  props: {
    submitSearch:{type:String,}
  },
  watch: {
    submitSearch: function(val) {
      if (val == "true") {
        this.$emit("query-data",this.queryform);
      }else if(val=="false"){
        this.$refs["queryform"].resetFields();
        setTimeout(()=>{
            this.$emit("refresh-quey-data",this.queryform);
            },200)
      };
      setTimeout(()=>{
        this.$emit("update:submitSearch","0");
      },200)
    },
  },
  methods:{

	show(parms){
        //清空用户选择
		this.submitSearch="false";
		this.innerDialogFormVisible=false;
        // this.tableParams.searchValue="";
        this.primaryId = undefined;
        this.clearChoose();
        this.getTableData(this.tableParams);
        //关闭表单页面
        this.isShow = parms;
	},

	innerSubmitSearchBtn(parms){
		this.innerSubmitSearch=parms;
	},

	getQueryData(parms){//获得搜索条件
        console.log('获取搜索条件： ',parms);
	    this._data.queryform.mchId = parms.id;
		this.innerDialogFormVisible=false;
		this.currentPage=1;
        this.tableParams.pageNo="1";
        this.tableParams.pageSize="10";
        this.tableParams.reqCode="-1";
		// var queryParamsVar = mergeQuery(this.tableParams,parms);
        // this.queryform.mchId=(queryParamsVar);
	},

	refreshQueyData(parms){//清空搜索内容
    	this.queryForm = parms;
    },


  }
};
</script>

<style rel="stylesheet" lang="scss" scoped>

</style>
